package com.jlpay.openapi.demo.ledger.balancesplit;

import com.jlpay.open.jlpay.sdk.java.model.ledger.request.BalanceQueryRequest;
import com.jlpay.open.jlpay.sdk.java.model.ledger.response.BalanceQueryResponse;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author dengwenning
 * @since 2024/8/30
 **/
public class BalanceQueryService {

    private static final Logger LOGGER = LoggerFactory.getLogger(BalanceQueryService.class);

    public static void main(String[] args) {
        BalanceQueryRequest balanceQueryRequest = buildBalanceQueryRequest();
        BalanceQueryResponse balanceQueryResponse = JlpayOpenApiService.openMerchService()
                .post(balanceQueryRequest, BalanceQueryResponse.class);
        LOGGER.info("账户余额查询响应:{}", JsonUtils.toString(balanceQueryResponse));
    }

    private static BalanceQueryRequest buildBalanceQueryRequest() {
        BalanceQueryRequest balanceQueryRequest = new BalanceQueryRequest();
        balanceQueryRequest.setOrgCode("50720711");
        balanceQueryRequest.setMchId("849581183510017");
        balanceQueryRequest.setAccountType("01");
        return balanceQueryRequest;
    }
}
